package com.bw.imageloader;

/**
 * @author:created by hahajing
 * 时间：2024/4/26 0026
 * 企鹅号:444511958
 * 描述:
 */
public class ImageOptions {

    private ImageOptions(){}
    public int placeImage;
    public int errorImage;
    public boolean skipMemoryCache;
    public boolean skipDiskCache;
    public ImageOptions(int _placeImage,int _errorImage,boolean _skipMemoryCache,boolean _skipDiskCache){
        this.placeImage=_placeImage;
        this.errorImage=_errorImage;
        this.skipMemoryCache=_skipMemoryCache;
        this.skipDiskCache=_skipDiskCache;
    }

    public static class Builder{
        /**
         * 占位图
         */
        private int placeImage;
        /**
         * 错误图
         */
        private int errorImage;
        /**
         * 开启内存缓存
         */
        private boolean skipMemoryCache;
        /**
         * 开启磁盘缓存
         */
        private boolean skipDiskCache;

        public Builder setPlaceImage(int placeImage) {
            this.placeImage = placeImage;
            return this;
        }

        public Builder setErrorImage(int errorImage) {
            this.errorImage = errorImage;
            return  this;
        }

        public Builder setSkipMemoryCache(boolean skipMemoryCache) {
            this.skipMemoryCache = skipMemoryCache;
            return this;
        }

        public Builder setSkipDiskCache(boolean skipDiskCache) {
            this.skipDiskCache = skipDiskCache;
            return  this;
        }

        public ImageOptions build(){
            return new ImageOptions(placeImage,errorImage,skipMemoryCache,skipDiskCache);
        }
    }
}
